package com.yanqu.road.server.manger.activity.chefduel;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.pb.chefduel.ChefDuelProto;
import com.yanqu.road.server.manger.activity.ActivityMgr;

import java.util.Map;
import java.util.Objects;

/**
 * 可赴宴的活动
 */
public class OtherActivityChefDuel2 extends ChefDuel2 {

    public OtherActivityChefDuel2(ActivityInfo acInfo) {
        super(acInfo);
    }

    @Override
    public boolean save() {
        return true;
    }

    public void syncCooker(ChefDuelProto.CrossChefDuel2CookerSyncMsg msg){
        ActivityInfo activityInfo = getActivityInfo();
        Map<Integer, ChefDuel2> cookBoy2Map = ChefDuelMgr.getChefDuel2Map();
        if(cookBoy2Map == null){
            return;
        }
        for (Map.Entry<Integer, ChefDuel2> entry : cookBoy2Map.entrySet()) {
            ChefDuel2 value = entry.getValue();
            if(ActivityMgr.activityInTime(value.getActivityInfo())){
                if(Objects.equals(activityInfo.getServerListStr2(), value.getActivityInfo().getServerListStr2())){
                    value.syncCooker(msg);
                }
            }
        }
    }
}
